package com.axxy.singleton;

/**
 * @author 一缕茜阳
 * @date 2021/7/28
 */
public class Store3 {
    private static Store3 store3;

    private Store3(){
        System.out.println("Store3——getInstance()方法改成同步方法，每个线程进入此方法时要等候别的线程离开，一旦有一个线程完成，" +
                "store3就不会是null,但是会有性能问题");
    }

    public static synchronized Store3 getInstance(){
        if (store3 == null) {
            store3 = new Store3();
        }
        return store3;
    }
}
